package com.kun.handler;

import com.kun.support.password.PasswordAuthenticationProvider;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;

import java.util.Arrays;
import java.util.List;

/**
 * 提供者
 *
 * @author kun.li
 */
public class CustomOAuth2TokenEndpointConfigurer implements Customizer<HttpSecurity> {

    @Override
    public void customize(HttpSecurity httpSecurity) {
        List<AuthenticationProvider> providerList = Arrays.asList(

                // oauth2 密码模式
                new PasswordAuthenticationProvider(httpSecurity)

        );
        providerList.forEach(httpSecurity::authenticationProvider);
    }
}
